home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
system
/
whoapc.zip
/
WHOA!.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-08-25
|
33KB
|
1,159 lines
;Name WHOA
;Title WHOA! Version 1.0 - Brad D Crandall, 1987
; All rights reserved.
;------------------------------------------------------------------------------
; WHOA!.asm - Brad D Crandall
;
;
; This program will slow a computer down so programs and
; games can be examined closely. Designed to run in a Text
; or graphic screen mode. To bring up WHOA!'s Menu,
; press <Alt> <F10>.
;
; Compiler: MASM Version 2.0 or greater.
; Computer: IBM PC or Compatible running on MS-DOS or
; PC-DOS Version 2.0 or greater. Also works
; on IBM's Personal System/2s under DOS 3.3.
;
; Compiling procedure:
; masm WHOA!;
; link WHOA!;
; exe2bin WHOA! WHOA!.com
;
; Notes:
; Care should be taken when determining what value to use for
; SET_MAX (located in EQUATE AREA). If the value is too large,
; a hard loop may result. The value 435 if optimum for a 12-MHz
; machine. Slower machines will need a slightly lower value.
;
; Special consideration has been taken to allow WHOA to be
; compatible with DOS versions earlier than 3.1, which do not
; support the MULTIPLEX interrupt protocol. WHOA uses the
; multiplex interrupt because it provides a broader range of
; software compatibility than do the eight conventional user
; interrupts.
;
; For older versions of DOS, WHOA uses a user interrupt
; (SLOW_INT) as the channel of communication to the resident
; portion of WHAO!. To provide full compatibility, SLOW_INT
; should be set to an interrupt that is not used by any of the
; software you wish to use WHOA with.
;
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; E Q U A T E A R E A
;------------------------------------------------------------------------------
MULTI_INT equ 2fh ; Multiplex used if DOS >= 3.1.
SLOW_INT equ 60h ; Interrupt used if DOS < 3.1,
; other possible values 60h-67h.
KEYBOARD_INT equ 16h ; Keyboard Interrupt.
TIME_INT equ 08h ; Time of Day Interrupt.
MULTI_HANDLE equ 89h ; Our Unique Multiplex ID.
INSTALL_CHECK equ 0h ; Code to check if resident.
UNINSTALL equ 1h ; Code to uninstall WHOA!
SET_LOOP equ 2h ; Code to set the delay loop.
STACK_SIZE equ 100h ; Size for our Stack.
HOT_KEY equ 7100h ; ALT F10.
STROBE_PAUSE equ 5 ; Strobe delay count setting.
SET_MIN equ 1 ; Minimum delay loop value.
SET_MAX equ 435 ; Maximum delay loop value.
TIME_PAUSE equ 100 ; Inner loop initial setting.
LOOP_DEFAULT equ 350 ; Delay default setting.
STROBE_BEGIN equ 28 ; Column coordinate for strobe.
STROBE_END equ 37 ; Column coordinate for strobe.
SCREEN_SIZE equ 16 * 1024 / 2 ; Size in words of largest
; screen to save.
BORDER = 16+14 ; Border color.
TEXT = 16+15 ; Text color.
DOS_CMP equ 0310h ; DOS comparison constant.
;--- Return Codes ---
NOT_INSTALLED equ 0 ; WHOA not installed return code.
INSTALLED equ 0ffh ; WHOA is installed return code.
ERROR equ 0feh ; Error occurred
OK equ 0fdh ; No errors occurred.
;------------------------------------------------------------------------------
; M A C R O A R E A
;------------------------------------------------------------------------------
;----------------------------------------------------
; DISPLAY_AT parm1,parm2,parm3,parm4 - Display
; message on screen starting at fixed
; location. Does not use DOS.
;
; parm1 = X coordinate of start of message.
; parm2 = Y coordinate of start of message.
; parm3 = Color of message.
; parm4 = String of character to display.
;----------------------------------------------------
DISPLAY_AT macro parm1,parm2,parm3,parm4
local label1,label2
jmp label2
label1 db parm4&,0
label2: mov si,offset cseg:label1
mov cx,&parm3
mov ax,&parm2
mov di,&parm1
call display_at_proc
endm
;---------------------------------------------------
; DISPLAY_DOS parm1 - Display a message to the
; console. Uses DOS function 09h.
;
; parm1 = Message to display.
;---------------------------------------------------
DISPLAY_DOS macro parm1
local label1,label2
jmp label2
label1 db parm1&,24h
label2: mov dx,offset cseg:label1
mov ah,09h
int 21h
endm
;-----------------------------------------------------
; RESIDENT parm1 - Executes the resident portion
; of WHOA! Determines which interrupt to
; use (multiplex or user) based on DOS version.
;
; parm1 - Resident function.
;-----------------------------------------------------
RESIDENT macro parm1
local label1,label2
mov al,&parm1
cmp cs:dos_version,DOS_CMP ; What DOS Version??
jae label1 ; Jump if DOS >= 3.1.
call call_interrupt
jmp label2
label1: mov ah,MULTI_HANDLE
int MULTI_INT
label2:
endm
;------------------------------------------------------------------------------
; C O D E A R E A
;------------------------------------------------------------------------------
cseg segment byte public 'code'
assume cs:cseg,ds:cseg
org 100h
slowdown proc far
jmp slowdown_0010
;------------------------------------------------------------------------------
; T S R D A T A A R E A
;------------------------------------------------------------------------------
dos_version dw ? ; Version number of DOS.
slow_interrupt db SLOW_INT ; Interrupt used if DOS < 3.1.
old_multi_int dd ? ; Address of old multiplex.
old_keyboard_int dd ? ; Address of old keyboard.
old_time_int dd ? ; Address of old time of day.
activated db 0 ; Switch to prevent re-entry.
crt_stat dw ? ; CRT port.
save_sp dw ? ; Save area of old stack.
save_ss dw ? ; Save area of old stack.
video_state db ? ; Save video state.
cursor_location dw ? ; Save cursor location.
current_page db ? ; Save page.
current_background db ? ; Current background color.
current_palette db ?
asc_value db 6 dup(0) ; Area for number display.
setting dw LOOP_DEFAULT ; Delay loop setting.
delay_switch db 1 ; Delay Switch on/off. 1 = ON.
strobe dw STROBE_BEGIN ; Location of strobe pattern.
move_strobe1 dw ? ; Delay countdown.
move_strobe2 dw ? ; Delay countdown.
screen_seg dw ? ; Address of screen.
enable db 1 ; Enable/disable switch.
columns db 80 ; Number of columns on screen.
;------------------------------------------------------------------------------
; T S R C O D E A R E A
;------------------------------------------------------------------------------
;-------------------------------------------------------
; multiplex - This procedure handles external
; communications for the memory resident
; portion of WHOA running on DOS 3.1 or
; greater.
;-------------------------------------------------------
multiplex proc far
;--- Check for our unique handle. If not found ---
;--- jump to next multiplex routine in chain. ----
cmp ah,MULTI_HANDLE
je multiplex_0010
jmp dword ptr cs:old_multi_int
multiplex_0010: call request
iret ; Must return as an interrupt routine.
multiplex endp
;-------------------------------------------------
; interrupt - This procedure handles external
; communications for the memory resident
; portion of WHOA running on DOS 3.0 or
; less.
;-------------------------------------------------
interrupt proc far
call request
iret
interrupt endp
;-----------------------------------------------
; request - This routine execute a slowdown
; function based on the contents of AL.
;
; Status returned in AL.
;-----------------------------------------------
request proc near
;--- We are being called. Find out why ---
request_0010: cmp al,INSTALL_CHECK ; Check for installed?
jne request_0020 ; Jump if NO.
mov al,INSTALLED ; We are already installed.
ret
request_0020: cmp al,UNINSTALL